package com.Dialogs;


import android.app.AlertDialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import com.Adapters.PictureListAdapter;
import com.Adapters.Items.ItemPostText;
import com.Adapters.Items.ItemProfile;
import com.shareup.R;


public class DialogText extends AlertDialog {

    public ItemPostText ItemText;

    private final ListView itemlist;

    private final OnItemClickListener OnOption = new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {

            if (position == 0) {
                if (ItemText != null) {
                    ItemText.delete();
                }
            }
            dismiss();
        }
    };

    private final View view;

    public DialogText(Context context, boolean isOwner) {

        super(context);

        LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        view = inflater.inflate(R.layout.dialog_action_list, null);
        //
        itemlist = (ListView) view.findViewById(R.id.item_list);
        //
        //
        this.setView(view);
        //
        String[] list = context.getResources().getStringArray(R.array.picture_menu_owner);
        PictureListAdapter adapter = new PictureListAdapter(context, R.layout.option_picture_text, R.id.text_comment);
        //
        // adapter.add(new ItemProfile(list[0], R.drawable.sprofile_icon_menu,
        // false));
        adapter.add(new ItemProfile(list[list.length - 1], R.drawable.delete_normal, 0, false));
        //
        itemlist.setAdapter(adapter);
        itemlist.setOnItemClickListener(OnOption);
    }

    @Override
    public void setTitle(CharSequence title) {

    }
}
